package com.abyss.transformation;

import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.DataSource;
import org.apache.flink.api.java.operators.UnionOperator;

import java.util.Arrays;

public class UnionDemo {
    public static void main(String[] args) throws Exception {
        // 1. Env
        ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

        // 2. Source
        DataSource<String> source1 = env.fromCollection(Arrays.asList("hadoop", "hive", "flume"));
        DataSource<String> source2 = env.fromCollection(Arrays.asList("hadoop", "hive", "spark"));

        // 3. source1和source2 进行合并
        UnionOperator<String> union = source1.union(source2);

        union.print();
    }
}